import Vue from 'vue'
import reshandler from 'services/response-handler'

/*
 * 更改密码
 */
function makeUpdatePwdData(response) {
  return Object.assign({}, response, {})
}

export function UpdatePwd(params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "UpdatePwd",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeUpdatePwdData), reshandler.error(fail))
}

/*
 * 检查号码
 */
function makeCheckUserNameOrTELData(response) {
  return Object.assign({}, response, {})
}

export function CheckUserNameOrTEL(params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "CheckUserNameOrTEL",
  })
  
  // invoke
  this.$.get(params)
  .then(reshandler.success(success, fail, makeCheckUserNameOrTELData), reshandler.error(fail))
}

/*
 * 发送验证码
 */
function makeSendValidateCodeData(response) {
  return Object.assign({}, response, {})
}

export function SendValidateCode(params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "SendValidateCode",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeSendValidateCodeData), reshandler.error(fail))
}